//
//  MXHomeDetialCommentsCell.m
//  CatchBear
//
//  Created by 王启颖 on 2018/12/12.
//  Copyright © 2018年 王启颖. All rights reserved.
//

#import "MXHomeDetialCommentsCell.h"

@interface MXHomeDetialCommentsCell ()
@property (weak, nonatomic) IBOutlet UILabel *homeDetialComment_lbl;

@end
@implementation MXHomeDetialCommentsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setModel:(MXCommentsModel *)model{
    _model = model;

    NSString *homeDetialComment = [NSString stringWithFormat:@"%@:%@",self.model.user.user_nickname,self.model.comments_info];
    
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:homeDetialComment];
    [attrStr addAttribute:NSForegroundColorAttributeName
                    value:MX_MAIN_COLOR
                    range:NSMakeRange(0, [self.model.user.user_nickname length]+1)];
    self.homeDetialComment_lbl.attributedText = attrStr;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    
    MXHomeDetialCommentsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = NSbunleloadNibName(@"MXHomeDetialCommentsCell");
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    
    return cell;
}

@end
